package wangjg.mda.model.obj;

import java.util.List;
import java.util.Map;

public class Model implements Element {
	private String name;
	private String label;
	private String description;
	private String packageName;
	private String parent;
	private List<ModelField> fields;
	private List<ModelField> staticFields;
	private List<Method> methods;
	private Map attributes;
	
	public Model() {}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public List<ModelField> getFields() {
		return fields;
	}
	public void setFields(List<ModelField> fields) {
		this.fields = fields;
	}
	public String getPackage() {
		return packageName;
	}
	public void setPackage(String _package) {
		this.packageName = _package;
	}
	public String getLabel() {
		return label;
	}

	public void setLabel(String lable) {
		this.label = lable;
	}

	public String getParent() {
		return parent;
	}

	public void setParent(String parent) {
		this.parent = parent;
	}

	public Map getAttributes() {
		return attributes;
	}

	public void setAttributes(Map attributes) {
		this.attributes = attributes;
	}
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public List<Method> getMethods() {
		return methods;
	}

	public void setMethods(List<Method> methods) {
		this.methods = methods;
	}

	public List<ModelField> getStaticFields() {
		return staticFields;
	}

	public void setStaticFields(List<ModelField> staticFields) {
		this.staticFields = staticFields;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result
				+ ((packageName == null) ? 0 : packageName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Model other = (Model) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (packageName == null) {
			if (other.packageName != null)
				return false;
		} else if (!packageName.equals(other.packageName))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "\nModel [packageName=" + packageName + ", parent=" + parent
				+ ", name=" + name + ", label=" + label + ", description="
				+ description + "\n, fields=" + fields + ",staticFields="+staticFields
				+ "\n, methods=" + methods
				+ "\n, attributes=" + attributes+"]";
	}

}
